Skip to content

refactor: 抽取共享模块,消除跨端重复代码 (~1500 行净省)#22

Open
eric8810 wants to merge 1 commit into
masterfrom
refactor/dedup-shared-modules
Open

refactor: 抽取共享模块,消除跨端重复代码 (~1500 行净省)#22
eric8810 wants to merge 1 commit into
masterfrom
refactor/dedup-shared-modules

Conversation

@eric8810

Copy link
Copy Markdown
Owner

Rust:

  • 新增 catcher-core::ffi_helpers (CancellationGuard/invoke_callback/parse_headers 等)
  • http_ffi 793→410, ws_ffi 234→147, sse_ffi 358→273, quality_ffi 165→125
  • WsStream 委托宏, 手写 base64→crate, retry when() 统一, MultipartError 删除, TLS 转换去重

TypeScript:

  • 新增 helpers.ts (createExecutor/sleep/classifyFetch/SSEStreamCore/SSEClientCore)
  • 新增 interceptors.ts (createInterceptorManager 共享)
  • 新增 sse-router.ts (routeLine/PushQueue 共享)
  • SSE stream/client 参数化 (各平台仅保留 readWithIdleTimeout 差异)
  • 删除 dead code: getLastRetryCount/clearDnsCache/mergeConfig

Dart:

  • 新增 ffi_utils.dart (allocFfiString/copyBytesToMalloc/FfiAsyncBridge/CatcherError)
  • _execute/_executeWithCancel 应用 FfiAsyncBridge
  • CatcherHttpError/CatcherWsError 统一为 CatcherError
  • 删除冗余 integration 测试 (roundtrip 子集)

Rust:
- 新增 catcher-core::ffi_helpers (CancellationGuard/invoke_callback/parse_headers 等)
- http_ffi 793→410, ws_ffi 234→147, sse_ffi 358→273, quality_ffi 165→125
- WsStream 委托宏, 手写 base64→crate, retry when() 统一, MultipartError 删除, TLS 转换去重

TypeScript:
- 新增 helpers.ts (createExecutor/sleep/classifyFetch/SSEStreamCore/SSEClientCore)
- 新增 interceptors.ts (createInterceptorManager 共享)
- 新增 sse-router.ts (routeLine/PushQueue 共享)
- SSE stream/client 参数化 (各平台仅保留 readWithIdleTimeout 差异)
- 删除 dead code: getLastRetryCount/clearDnsCache/mergeConfig

Dart:
- 新增 ffi_utils.dart (allocFfiString/copyBytesToMalloc/FfiAsyncBridge/CatcherError)
- _execute/_executeWithCancel 应用 FfiAsyncBridge
- CatcherHttpError/CatcherWsError 统一为 CatcherError
- 删除冗余 integration 测试 (roundtrip 子集)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant